package comm.jr.service.impl;

import comm.jr.entry.Standard;
import comm.jr.mapper.StandardMapper;
import comm.jr.service.StandardService;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class StandardImpl implements StandardService {


    @Autowired
    private StandardMapper standardMapper;

    @Override
    public ArrayList<Standard> getAll(int offset, int limit) {
        RowBounds rowBounds = new RowBounds(offset, limit);
        return standardMapper.selectAll(rowBounds);
    }

    @Override
    public int insertStandard(Standard standard) {
        System.out.println(standard);
        return standardMapper.insertStandard(standard);
    }

    @Override
    public int updateStandard(Standard standard) {
        return standardMapper.updateStandard(standard);
    }

    @Override
    public int deleteStandard(Standard standard) {
        return standardMapper.deleteStandard(standard);
    }

    @Override
    public int getAllNumber() {
      return   (standardMapper.getAllNumber()).size();
    }
}
